package com.threadmethod.sleep;

/**
 * @PackageName:com.threadmethod.sleep
 * @ClassName:SubThread
 * @Description: 子线程休眠
 * @Author: zhangxiaoyu
 * @date 2020/11/19 14:29
 */
public class SubThread04 extends Thread{

    @Override
    public void run() {
        try {
            System.out.println("run,ThreadName="+Thread.currentThread().getName()+"开始时间"+System.currentTimeMillis());
            Thread.sleep(2000);
            System.out.println("run,ThreadName="+Thread.currentThread().getName()+"结束时间"+System.currentTimeMillis());
        } catch (InterruptedException e) {
            //在子线程的run方法中，如果有受监异常（编译时异常）需要处理，只有选择捕获处理，不能抛出处理
            e.printStackTrace();
        }
    }
}
